<template>
  <div class="page-box">
    <div class="title-card-box"><TitleCard :iconClassName="'el-icon-s-order'" :title="'资金流水-奖励明细'"></TitleCard></div>



  <div class="table-box">
    <CustomizeTable :columns="columns" :fetch-data="fetchTableData" permission-prefix="withdrawal:manage" :show-selection="true"
      :show-index="false" :export-file-name="'提现'" :init-search-form="{}" :showOperation="false"
      @reset="reset" ref="table">

    </CustomizeTable>


  </div>

  </div>
</template>

<script>
  import {

  } from '@/constants/statusMap';
  import {toString} from "@/utils/tools.js";

  import CustomizeTable from "@/components/CustomizeTable.vue";

  export default {
    components: {

      CustomizeTable,

    },
    data() {
      return {

        dialogVisible: false,
        currentRow: null,
        columns: [
          // {
          //   prop: "id",
          //   label: "ID"
          // },
          // {
          //   prop: "avatar",
          //   label: "头像"
          // },

          // {
          //   prop: "phone_number",
          //   label: "账号"
          // },
          // {
          //   prop: "nickname",
          //   label: "昵称"
          // },


          {
            prop: "baseInfo",
            label: "基本信息",
            slot: "baseInfo" ,
            width:"200px"

          },



          {
            prop: "linshicoin_balance",
            label: "邻事币"
          },
          {
            prop: "integral",
            label: "积分"
          },
          {
            prop: "follow_num",
            label: "关注数量"
          },


          {
            prop: "create_time",
            label: "创建时间"
          },
          {
            prop: "last_login_time",
            label: "最后登录时间"
          },


        ],



        searchForm: {


        },
      };
    },
    methods: {

      hangToString(val){
       return toString(val)
      },
      // 获取表格数据
      async fetchTableData(params = {}) {

        const postData = Object.assign({}, params, this.searchForm);
        try {
          const result = await this.$httpRequest.post('/user/list', postData)
          console.log('-------fetchTableData----', result)
          return result
        } catch (e) {
          this.$message.error(e.message)
          throw e // 保持错误继续向上传递
        }

      },
      //重置
      reset() {


      },
      // 编辑
      handleEdit(row) {
        // 打开编辑对话框逻辑
        this.currentRow = {
          ...row
        }; // 可深拷贝
        this.dialogVisible = true;
      },

      // 删除
      async handleDelete(row) {
        console.log("删除:", row);
      },

      // 状态变更
      async handleStatusChange(row) {
        console.log("状态变更:", row);
        this.$message.success("状态更新成功");
      },

      handleApprove(payload) {
        console.log("-----状态变更----:", payload);
        this.$httpRequest.post('/user/status', payload).then(result => {
          console.log('--approved---result------', result)
          if (result.code == 0) {
            this.$message.success('完成状态修改')
            this.$refs.table.refresh()
          } else {
            this.$message.error('状态修改失败')
          }
        }).catch(e => {
          this.$message.error(e.message)
        });
      },



    },
  };
</script>

<style>
  .page-box {
    padding: 20px;

  }

  .panbox {
    display: flex;
    justify-content: space-between;
    align-content: center;
    background-color: #fff;
    width: 100%;
    padding: 30px;
    box-sizing: border-box;
    min-height: 200px;
  }

  .panbox-item {
    display: flex;
    align-items: center;
    flex: 1;
    padding: 20px 50px;
    box-sizing: border-box;
    border-radius: 20px;

    position: relative;
    height: 50px;
  }


  .panbox-item-ex {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 20px 50px;
    box-sizing: border-box;
    border-radius: 10px;
    background-color: #fff;
    position: absolute;
    top: 8px;
    left: 0;
    box-shadow: 2px 2px 2px 2px #efefef;
  }


   .pit1-bg{
     background-color: #5772ef;
   }

   .pit2-bg{
     background-color: #4d45cd;
   }

   .pit3-bg{
     background-color: #529bf0;
   }

   .pit4-bg{
     background-color: #55ccf1;
   }



  .pit-1 {
    font-size: 12px;
    color: #999;
  }

  .pit-2 {
    margin-top: 5px;
    font-size: 24px;
    font-weight: 600;
    color: #111;
  }

  .pit-3 {
    margin-top: 5px;
    font-size: 12px;
    color: #008B00;
  }

  .pi-img-box {
    width: 45px;
    height: 45px;
    border-radius: 10px;

    box-sizing: border-box;
    overflow: hidden;
  }


  .p-10{
    padding: 10px;
  }
  .p-5{
    padding: 5px;
  }

  .pi-img-box img {
    width: 100%;
    height: 100%;
  }

  .panbox-item-title-box {
    padding-left: 20px;
    box-sizing: border-box;
  }

  .full-fix {
    width: 20px;
    height: 40px;
  }

  .table-box{
    width: 100%;
    margin-top: 20px;
  }
</style>
